<?php
require_once("model/JKConfigBean.class.php");
class Bconfig {
	var $db;
 	var $smarty;	
	public function __construct($db, $smarty) {
		$this->db = $db;
		$this->smarty = $smarty;
	}
		
	public function __destruct() {
		//
	}
	
	public function edit_config() {
		if ($_POST != "") {
			$cnfdata = JKConfigBean::get_all_config_data($this->db,$_SESSION['LC_ALL']);
			//var_dump($cnfdata);
			if($cnfdata!=''){
				JKConfigBean::update_config_data($this->db,$_POST,$_SESSION['LC_ALL']);
			}else{
				JKConfigBean::save_config_data($this->db,$_POST,$_SESSION['LC_ALL']);
			}
			header("Location: ./?mod=Bconfig");
		}	
	}
	public function process() {
		if(isset($_POST['act'])) {
			$act = $_POST['act'];
			if($act == "actionconfig") {
				$this->edit_config();
			}
		}
		$cnfdata = JKConfigBean::get_all_config_data($this->db,$_SESSION['LC_ALL']);
		$this->smarty->assign("CONFIGDATA", $cnfdata);
		$this->smarty->display('config.tpl');
	}
}
?>